 package com.cxl.other.mode;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintStream;
 
 public class interceptString
 {
   String interceptStr;
   int interceptByte;
 
   public interceptString(String str, int bytes)
   {
     this.interceptStr = str;
     this.interceptByte = bytes;
     System.out.println("字符串为：'" + this.interceptStr + "';字节数为：" + this.interceptByte);
   }
 
   public void interceptIt() {
     int interceptCount = this.interceptStr.length() % this.interceptByte == 0 ? this.interceptStr
       .length() / this.interceptByte : this.interceptStr.length() / 
       this.interceptByte + 1;
     System.out.println(this.interceptStr.getBytes().length);
     System.out.println("截取后断数为：" + interceptCount);
     for (int i = 1; i <= interceptCount; i++)
       if (i == interceptCount)
         System.out.println(this.interceptStr.substring((i - 1) * 
           this.interceptByte, this.interceptStr.length()));
       else
         System.out.println(this.interceptStr.substring((i - 1) * 
           this.interceptByte, i * this.interceptByte));
   }
 
   public static void main(String[] args)
   {
     String s = "";
     InputStreamReader ir = new InputStreamReader(System.in);
     BufferedReader in = new BufferedReader(ir);
     try {
       s = in.readLine();
       interceptString ss = new interceptString(s, 6);
       ss.interceptIt();
       in.close();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
 }

/* Location:           E:\work\eclipse3.6_\workspace\design_pattern\
 * Qualified Name:     com.cxl.other.mode.interceptString
 * JD-Core Version:    0.6.1
 */